//package com.booter.producer.config.strategy;
//
//import lombok.extern.slf4j.Slf4j;
//import org.apache.shardingsphere.api.sharding.complex.ComplexKeysShardingAlgorithm;
//import org.apache.shardingsphere.api.sharding.complex.ComplexKeysShardingValue;
//import org.springframework.util.CollectionUtils;
//
//import java.text.SimpleDateFormat;
//import java.util.ArrayList;
//import java.util.Collection;
//import java.util.Date;
//import java.util.List;
//import java.util.Map;
//
//@Slf4j
//public class MyComplexShardingAlgorithm implements ComplexKeysShardingAlgorithm {
//
//    @Override
//    public Collection<String> doSharding(Collection collection, ComplexKeysShardingValue complexKeysShardingValue) {
//        List<String> shardingSuffix = new ArrayList<>();
//        //获取分表字段及字段值
//        Map<String, Collection<Date>> map = complexKeysShardingValue.getColumnNameAndShardingValuesMap();
//        //获取字段值
//        Collection<Date> shardingValues = map.get("regdate");
//        if (!CollectionUtils.isEmpty(shardingValues)) {
//            for (Date date : shardingValues) {
//                //获取日期时间所在的月份
//                String str = new SimpleDateFormat("MM").format(date);
//                //添加记录所在分表表名集合
//                shardingSuffix.add(complexKeysShardingValue.getLogicTableName() + "_" + str);
//            }
//        }
//
//        return shardingSuffix;
//    }
//}